package facilius.controller.actionmanager;

import facilius.controller.ActionManager;
import facilius.controller.action.frequencia.FrequenciaCreateAction;
import facilius.controller.action.frequencia.FrequenciaReadAction;
import facilius.controller.action.frequencia.FrequenciaShowFormAction;
import org.mentawai.authorization.Permission;
import org.mentawai.core.ActionConfig;
import org.mentawai.core.ApplicationManager;
import org.mentawai.core.Forward;
import org.mentawai.core.Redirect;
import org.mentawai.filter.AuthorizationFilter;

/**
 *
 * @author Graciano
 */
public class FrequenciaActionManager implements ActionManager{

    public void loadActions(ApplicationManager appManager) {
        ActionConfig ac = null;

        ac = new ActionConfig("FrequenciaShowForm",FrequenciaShowFormAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("jsp/frequencia/frequenciaForm.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("frequencia")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("FrequenciaCreate",FrequenciaCreateAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Redirect("AulaRead.mtw"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("frequencia")));
        appManager.addActionConfig(ac);

        ac = new ActionConfig("FrequenciaRead",FrequenciaReadAction.class);
        ac.addConsequence(ApplicationManager.SUCCESS, new Forward("jsp/frequencia/frequenciaList.page"));
        ac.addConsequence(appManager.ERROR, new Forward("jsp/erro.page"));
        ac.addFilter(new AuthorizationFilter(new Permission("frequencia")));
        appManager.addActionConfig(ac);

    }

}
